import React, { Component, PropTypes } from 'react';

const styles = {
  clickToReview: {
    background: 'yellow',
  },
};

export default class ClickToReview extends Component {
  constructor(props) {
    super(props);

    this.state = {
      shouldReveal: false,
    };
  }

  render() {
    if (this.state.shouldReveal) {
      return <span><strong>{this.props.text}</strong></span>;
    }
    return (
      <span
        style={styles.clickToReview}
        onClick={() => this.setState({ shouldReveal: true })}
      >
        Click to review
      </span>
    );
  }
}

ClickToReview.propTypes = {
  text: PropTypes.string.isRequired,
};
